package android.support.v4.media.session;

import android.os.Build.VERSION;
import android.os.Bundle;
import android.os.Parcel;
import android.os.Parcelable;
import android.os.Parcelable.Creator;
import android.text.TextUtils;
import androidx.annotation.RestrictTo;
import androidx.annotation.RestrictTo.d;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.util.ArrayList;
import java.util.List;
import o.ab;
import o.ab.e;
import o.ac;

public final class PlaybackStateCompat implements Parcelable {
    public static final Creator<PlaybackStateCompat> CREATOR = new Creator<PlaybackStateCompat>() {
        public /* synthetic */ Object createFromParcel(Parcel parcel) {
            return ˋ(parcel);
        }

        public /* synthetic */ Object[] newArray(int i) {
            return ˋ(i);
        }

        public PlaybackStateCompat ˋ(Parcel parcel) {
            return new PlaybackStateCompat(parcel);
        }

        public PlaybackStateCompat[] ˋ(int i) {
            return new PlaybackStateCompat[i];
        }
    };
    List<CustomAction> ʻ;
    final CharSequence ʼ;
    final long ʽ;
    final int ˊ;
    private Object ˊॱ;
    final float ˋ;
    final long ˎ;
    final long ˏ;
    final long ॱ;
    final Bundle ॱˊ;
    final long ॱॱ;
    final int ᐝ;

    @RestrictTo({d.ˊ})
    @Retention(RetentionPolicy.SOURCE)
    public @interface Actions {
    }

    public static final class CustomAction implements Parcelable {
        public static final Creator<CustomAction> CREATOR = new Creator<CustomAction>() {
            public /* synthetic */ Object createFromParcel(Parcel parcel) {
                return ॱ(parcel);
            }

            public /* synthetic */ Object[] newArray(int i) {
                return ˏ(i);
            }

            public CustomAction ॱ(Parcel parcel) {
                return new CustomAction(parcel);
            }

            public CustomAction[] ˏ(int i) {
                return new CustomAction[i];
            }
        };
        private final Bundle ˊ;
        private final int ˋ;
        private final CharSequence ˎ;
        private Object ˏ;
        private final String ॱ;

        CustomAction(String str, CharSequence charSequence, int i, Bundle bundle) {
            this.ॱ = str;
            this.ˎ = charSequence;
            this.ˋ = i;
            this.ˊ = bundle;
        }

        CustomAction(Parcel parcel) {
            this.ॱ = parcel.readString();
            this.ˎ = (CharSequence) TextUtils.CHAR_SEQUENCE_CREATOR.createFromParcel(parcel);
            this.ˋ = parcel.readInt();
            this.ˊ = parcel.readBundle(MediaSessionCompat.class.getClassLoader());
        }

        public void writeToParcel(Parcel parcel, int i) {
            parcel.writeString(this.ॱ);
            TextUtils.writeToParcel(this.ˎ, parcel, i);
            parcel.writeInt(this.ˋ);
            parcel.writeBundle(this.ˊ);
        }

        public int describeContents() {
            return 0;
        }

        public static CustomAction ॱ(Object obj) {
            if (obj == null || VERSION.SDK_INT < 21) {
                return null;
            }
            CustomAction customAction = new CustomAction(e.ˋ(obj), e.ˊ(obj), e.ॱ(obj), e.ˎ(obj));
            customAction.ˏ = obj;
            return customAction;
        }

        public String toString() {
            return "Action:mName='" + this.ˎ + ", mIcon=" + this.ˋ + ", mExtras=" + this.ˊ;
        }
    }

    @RestrictTo({d.ˊ})
    @Retention(RetentionPolicy.SOURCE)
    public @interface ErrorCode {
    }

    @RestrictTo({d.ˊ})
    @Retention(RetentionPolicy.SOURCE)
    public @interface MediaKeyAction {
    }

    @RestrictTo({d.ˊ})
    @Retention(RetentionPolicy.SOURCE)
    public @interface RepeatMode {
    }

    @RestrictTo({d.ˊ})
    @Retention(RetentionPolicy.SOURCE)
    public @interface ShuffleMode {
    }

    @RestrictTo({d.ˊ})
    @Retention(RetentionPolicy.SOURCE)
    public @interface State {
    }

    public static int ˋ(long j) {
        if (j == 4) {
            return 126;
        }
        if (j == 2) {
            return 127;
        }
        if (j == 32) {
            return 87;
        }
        if (j == 16) {
            return 88;
        }
        if (j == 1) {
            return 86;
        }
        if (j == 64) {
            return 90;
        }
        if (j == 8) {
            return 89;
        }
        if (j == 512) {
            return 85;
        }
        return 0;
    }

    PlaybackStateCompat(int i, long j, long j2, float f, long j3, int i2, CharSequence charSequence, long j4, List<CustomAction> list, long j5, Bundle bundle) {
        this.ˊ = i;
        this.ˏ = j;
        this.ॱ = j2;
        this.ˋ = f;
        this.ˎ = j3;
        this.ᐝ = i2;
        this.ʼ = charSequence;
        this.ॱॱ = j4;
        this.ʻ = new ArrayList(list);
        this.ʽ = j5;
        this.ॱˊ = bundle;
    }

    PlaybackStateCompat(Parcel parcel) {
        this.ˊ = parcel.readInt();
        this.ˏ = parcel.readLong();
        this.ˋ = parcel.readFloat();
        this.ॱॱ = parcel.readLong();
        this.ॱ = parcel.readLong();
        this.ˎ = parcel.readLong();
        this.ʼ = (CharSequence) TextUtils.CHAR_SEQUENCE_CREATOR.createFromParcel(parcel);
        this.ʻ = parcel.createTypedArrayList(CustomAction.CREATOR);
        this.ʽ = parcel.readLong();
        this.ॱˊ = parcel.readBundle(MediaSessionCompat.class.getClassLoader());
        this.ᐝ = parcel.readInt();
    }

    public String toString() {
        StringBuilder stringBuilder = new StringBuilder("PlaybackState {");
        stringBuilder.append("state=").append(this.ˊ);
        stringBuilder.append(", position=").append(this.ˏ);
        stringBuilder.append(", buffered position=").append(this.ॱ);
        stringBuilder.append(", speed=").append(this.ˋ);
        stringBuilder.append(", updated=").append(this.ॱॱ);
        stringBuilder.append(", actions=").append(this.ˎ);
        stringBuilder.append(", error code=").append(this.ᐝ);
        stringBuilder.append(", error message=").append(this.ʼ);
        stringBuilder.append(", custom actions=").append(this.ʻ);
        stringBuilder.append(", active item id=").append(this.ʽ);
        stringBuilder.append("}");
        return stringBuilder.toString();
    }

    public int describeContents() {
        return 0;
    }

    public void writeToParcel(Parcel parcel, int i) {
        parcel.writeInt(this.ˊ);
        parcel.writeLong(this.ˏ);
        parcel.writeFloat(this.ˋ);
        parcel.writeLong(this.ॱॱ);
        parcel.writeLong(this.ॱ);
        parcel.writeLong(this.ˎ);
        TextUtils.writeToParcel(this.ʼ, parcel, i);
        parcel.writeTypedList(this.ʻ);
        parcel.writeLong(this.ʽ);
        parcel.writeBundle(this.ॱˊ);
        parcel.writeInt(this.ᐝ);
    }

    public static PlaybackStateCompat ˋ(Object obj) {
        if (obj == null || VERSION.SDK_INT < 21) {
            return null;
        }
        Bundle ˎ;
        List<Object> ᐝ = ab.ᐝ(obj);
        List list = null;
        if (ᐝ != null) {
            list = new ArrayList(ᐝ.size());
            for (Object ॱ : ᐝ) {
                list.add(CustomAction.ॱ(ॱ));
            }
        }
        if (VERSION.SDK_INT >= 22) {
            ˎ = ac.ˎ(obj);
        } else {
            ˎ = null;
        }
        PlaybackStateCompat playbackStateCompat = new PlaybackStateCompat(ab.ˏ(obj), ab.ˊ(obj), ab.ˋ(obj), ab.ˎ(obj), ab.ॱ(obj), 0, ab.ʽ(obj), ab.ʻ(obj), list, ab.ॱॱ(obj), ˎ);
        playbackStateCompat.ˊॱ = obj;
        return playbackStateCompat;
    }
}
